import { getPrescriptionOrderDetailAPI } from '@/api/order'
import type { MedicalOrderDetail } from '@/types/order'
import { ref } from 'vue'

// 导出一个自定义hook 传入一个订单id 返回 订单详情数据
export const useOrderDetail = (orderId: string) => {
  const orderDetail = ref<MedicalOrderDetail>()
  const getOrderDetail = async () => {
    orderDetail.value = await getPrescriptionOrderDetailAPI(orderId)
  }
  getOrderDetail()
  return { orderDetail, getOrderDetail }
}
